Special verbs for external Human Interface Applications
There are many applications that can either provide special human interfaces, or that simply need to be able to 'tell' XTension to 'do things' to items in the database.
all of list: Return a 'list' of all verbs, globals, and groups
all of list string -- verbs, globals, groups
example :
set aList to "" as list
set aList to all of list "Globals"
write log "we got this many global scripts: " & (count of items of aList)
repeat with x from 1 to count of items of aList
set z to item x of aList
write log "Like this : " & z
end repeat
Thus, you can gain access to all of the global scripts, all of the verbs that XTension serves, and the names of all of the Groups in your database.
all of group: Return a 'list' of all units in a specified 'Group'
all of group string -- name of Group,
example :
set aList to "" as list
set uList to "" as list
set aList to all of list "Groups"
write log "we got this many Groups: " & (count of items of aList)
repeat with x from 1 to count of items of aList
set g to item x of aList
write log "In group : " & g & " we have these units : "
set uList to all of group g
repeat with z from 1 to count of items of uList
set u to item z of uList
write log " : " & u
end repeat
end repeat
write log "Last unit of last group is : " & last item of uList
add unit to group Add a unit to a named group
add string to group string -- Name of Database Unit and name of Group
remove unit from group Remove a unit from a named group
add string to group string -- Name of Database Unit and name of Group
examples :
add unit "Front Door Light" to group "Night Lights"
remove unit "Front Door Light" from group "Night Lights"
Now you can see the need for the next command...
unit type: Return a 'list' of all units of a specified 'type'
unit type string -- all, real, dimmable, analog, discrete
example :
set aList to "" as list
set aList to unit type "analog"
write log "we got this many analog units: " & (count of items of aList)
write log "and here's their names and current value:"
repeat with x from 1 to count of items of aList
set u to item x of aList
write log " : " & u & (value of u)color green
end repeat
There is much to be done in this area, but until XTension adopts the entire 'object model', these new verbs will provide a great deal of flexibility to any external application or applet.